<template>
  <div class="seat">
    <el-form
      :model="formData"
      :rules="rules"
      ref="form"
      label-width="60px"
      label-position="left"
    >
      <el-row>
        <el-form-item label="订单号" prop="id">
          <el-input v-model="formData.id" placeholder="请输入订单号"></el-input>
        </el-form-item>
      </el-row>
      <el-button class="submit" @click="onSubmit">去选座</el-button>
    </el-form>
  </div>
</template>

<script lang="ts">
import { defineComponent, ref, reactive } from 'vue';
import { routeLocationKey } from 'vue-router';
import router from '@/router/index';

export default defineComponent({
  name: 'SeatSelection',
  setup() {
    //表单数据验证
    const formData = ref({
      id: '',
    });
    const rules = {
      id: [{ required: true, message: '请输入订单号' }],
    };
    const form = ref(null);
    const onSubmit = () => {
      (form.value as any).validate((valid: boolean) => {
        if (valid) {
          router.push('/seat');
        } else {
          console.log('error submit!!');
          return false;
        }
      });
      // console.log((form.value as any).validate);
      // console.log('formData.value: ', formData.value);
    };

    return {
      formData,
      rules,
      form,
      onSubmit,
    };
  },
});
</script>

<style lang="scss" scoped>
@import '@/assets/css/config.scss';
.seat {
  margin-left: 180px;
  margin-top: 50px;
}
:deep(.el-input__inner) {
  width: 250px;
  margin-right: 20px;
}
//提交按钮
.submit {
  background-color: $themeRed;
  color: white;
  width: 300px;
  font-size: 20px;
  letter-spacing: 20px;
  padding-left: 38px;
  float: right;
  margin-top: 100px;
  margin-right: 20px;
}
</style>
